package com.woniumall.web;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.woniumall.pojo.Category;
import com.woniumall.pojo.Goods;
import com.woniumall.service.CategoryService;
import com.woniumall.service.impl.CategoryServiceImpl;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * @auther linke
 * @create 2021-10-28 19:17
 */
@WebServlet("/category/*")
public class CategoryServlet extends BaseServlet{
    //获得服务操作对象
    private CategoryService categoryService = new CategoryServiceImpl();

    /**
     * 查询所有图书类类别并响应
     * @param request
     * @param response
     * @throws Exception
     */
    public void findAll(HttpServletRequest request, HttpServletResponse response) throws Exception {
        //调用方法
        List<Category> list = categoryService.findAll();
        //调用父类中的工具类响应回json
        responseUtil(response,list);
    }

}
